<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<base href="<%=basePath%>">

		<title>My JSP 'spedt.jsp' starting page</title>

		<meta http-equiv="pragma" content="no-cache">
		<meta http-equiv="cache-control" content="no-cache">
		<meta http-equiv="expires" content="0">
		<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
		<meta http-equiv="description" content="This is my page">
		<!--
		<link rel="stylesheet" type="text/css" href="styles.css">
		-->
<script src="js/date.js" type="text/javascript"></script>
		<SCRIPT src="js/jquery.js" type="text/javascript"></SCRIPT>
		<script type="text/javascript">
			 $(document).ready(function(){
				$("#dlb").slideUp("slow");
				$("#zybl").slideUp("slow");
				$("#mzbl").slideUp("slow");
				$("#inhisbl").slideUp("slow");
				$("#dlb").slideDown("slow"); 
				$("#mzbl").slideDown("slow");
			 
			//得到科室
            	$.getJSON("type.do?method=getKeshi",function(data){
                        if (data.length != 0) {          
                            $("#ks").html("<option value=''>请选择科室</option>");
                            for (i = 0; i < data.length; i++) {
					//追加option
                                $("#ks").append("<option value=" + data[i].ks_id + ">" + data[i].ks_name + "</option>");
                            }
                        }
               });
               //当改变科室时,绑定对象
               $("#ks").bind("change", function(){
					//得到改变后的值
                    var getvalue = $("#ks option:selected").val(); 
                    if (getvalue != null) {
                    //得到科室下面的科别
                        $.getJSON("type.do?method=getKebie", {ks_id: getvalue}, function(data){
                            if (data.length != 0) {
                                $("#kb").html("<option value=''>请选择科别</option>");
                                for (i = 0; i < data.length; i++) {
									//追加option
                                    $("#kb").append("<option value=" + data[i].kb_id + ">" + data[i].kb_name + "</option>");
                                }
                            }
                        });
                    }
           			 });
			 });
			function showfacname(){
				$("#facname").val($("#kb").val());
			}
			function show(){
				if($("#lx").val() == 1){
					$("#zybl").slideUp("slow");
					$("#inhisbl").slideUp("slow");
					$("#mzbl").slideDown("slow");
				}
				if($("#lx").val() == 2){
					$("#mzbl").slideUp("slow");
					$("#zybl").slideUp("slow");
					$("#inhisbl").slideDown("slow");
				}
				if($("#lx").val() == 3){
					$("#mzbl").slideUp("slow");
					$("#inhisbl").slideUp("slow");
					$("#zybl").slideDown("slow");
				}
				
			}
			
			function zyCheck(){
                        var zyzs = document.zyForm.zyzs.value;   
                        var zytime = document.zyForm.zytime.value; 
                         var zybs = document.zyForm.zybs.value;   
                        var zyzd = document.zyForm.zyzd.value; 
                         var zycl = document.zyForm.zycl.value;   
                        var zyyw = document.zyForm.zyyw.value;  
                          var zydoctor = document.zyForm.zydoctor.value;  
                        if(zyzs==""){
	                        alert("主诉不能为空!");
	                        return false;
                        }
                        
                         if(zytime==""){
	                        alert("时间不能为空！");
	                        return false;
                        }
                         if(zybs==""){
	                        alert("病史不能为空！");
	                        return false;
                        }
                         if(zyzd==""){
	                        alert("初步诊断不能为空！");
	                        return false;
                        }
                        if(zycl==""){
	                        alert("处理措施不能为空！");
	                        return false;
                        }
                         if(zyyw==""){
	                        alert("药方不能为空！");
	                        return false;
                        }
                         if(zydoctor==""){
	                        alert("医生不能为空！");
	                        return false;
                        }
                        
                         return true;
                     }
                     
                     function inCheck(){
                        var inhdate = document.inForm.inhdate.value;   
                        var inhdiatnlose = document.inForm.inhdiatnlose.value; 
                         var outhdate = document.inForm.outhdate.value;   
                        var ywlist = document.inForm.ywlist.value; 
                        if(inhdate==""){
	                        alert("住院时间不能为空!");
	                        return false;
                        }
                        
                         if(inhdiatnlose==""){
	                        alert("住院诊断不能为空！");
	                        return false;
                        }
                         if(outhdate==""){
	                        alert("出院时间不能为空！");
	                        return false;
                        }
                         if(ywlist==""){
	                        alert("出院带药不能为空！");
	                        return false;
                        }
                        
                         return true;
                     }
                     
                      function mzCheck(){
                        var ks = document.mzForm.ks.value;   
                        var qtype = document.mzForm.qtype.value; 
                         var casetime = document.mzForm.casetime.value;   
                        var mainsym = document.mzForm.mainsym.value; 
                        var consultbody = document.mzForm.consultbody.value;   
                        var asssonsult = document.mzForm.asssonsult.value; 
                         var pridiagnose = document.mzForm.pridiagnose.value;   
                        var dealmethod = document.mzForm.dealmethod.value; 
                          var recdoctor = document.mzForm.recdoctor.value; 
                        if(ks==""){
	                        alert("科室不能为空!");
	                        return false;
                        }
                        
                         if(qtype==""){
	                        alert("科别不能为空！");
	                        return false;
                        }
                         if(casetime==""){
	                        alert("时间不能为空！");
	                        return false;
                        }
                         if(mainsym==""){
	                        alert("主诉不能为空！");
	                        return false;
                        }
                        
                         if(consultbody==""){
	                        alert("查体不能为空！");
	                        return false;
                        }
                         if(asssonsult==""){
	                        alert("辅助检查不能为空！");
	                        return false;
                        }
                         if(pridiagnose==""){
	                        alert("初步诊断不能为空！");
	                        return false;
                        }
                         if(dealmethod==""){
	                        alert("处理措施不能为空！");
	                        return false;
                        }
                         if(recdoctor==""){
	                        alert("记录医生不能为空！");
	                        return false;
                        }
                        
                         return true;
                     }
		</script>
	</head>
	<body>
		<c:if test="${message != null}">
			<p style="background-color: #87CEFF; text-align: center">
					${message}
			</p>
		</c:if>
			<p>
					<div id="dlb" align="center">
						<select id="lx" onchange="show()">
							<option value="1">门诊病历</option>
							<option value="2">住院病历</option>
							<option value="3">中医病历</option>
						</select>
					</div>
		<center>
		<div id="mzbl">
			<form action="disease.do?method=addDisease" method="post" name="mzForm">
			<input class="jyts_bk2" size="10" type="hidden" name="mzuid" id="mzuid" value="${uidadd}"/>
			<INPUT class=jyts_bk2 size=10 type="hidden" name="facname" id="facname"/>
			<TABLE border=0 cellSpacing=1 cellPadding=0 width=800 bgColor=#9bc8eb>
				<TBODY>
					<TR>
						<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
							align=center colspan="2"> 
											<span class="keshi"> 
												<SELECT id="ks" name="ks">
													<option value="">
														请选择科室
													</option>
												</SELECT>
											</span>
											<!--科别 -->
											<span class="kebie" id="kbs"> 
												<SELECT id="kb"
													name="qtype" onchange="showfacname()">
													<option value="">
														请选择科别
													</option>
												</SELECT> 
											</span>
						</TD>
					</TR>
					<TR>
						<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
							align=right>
							时间
						</TD>
						<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
							colSpan=2 align=left>
							<INPUT class=jyts_bk2 size=15 type=text name="casetime" readonly="readonly" onfocus="HS_setDate(this)"/>
						</TD>
					</TR>
					<TR>
						<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
							align=right>
							主诉
						</TD>
						<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
							colSpan=2 align=left>
						<INPUT class=jyts_bk2 size=15 type=text  name="mainsym"/>
						</TD>
					</TR>
					<TR>
						<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
							align=right>
							查体
						</TD>
						<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
							colSpan=2 align=left>
							<INPUT class=jyts_bk2 size=15 type=text  name="consultbody"/>						
						</TD>
					</TR>
					<TR>
						<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
							align=right>
							 辅助检查
						</TD>
						<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
							colSpan=2 align=left>
							<textarea rows="3" name="asssonsult" cols="80"></textarea>
						</TD>
					</TR>
					<TR>
						<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
							align=right>
							初步诊断
						</TD>
						<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
							colSpan=2 align=left>
							<textarea rows="3" cols="80" name="pridiagnose"></textarea>
						</TD>
					</TR>
					<TR>
						<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
							align=right>
							处理措施
						</TD>
						<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
							colSpan=2 align=left>
							<textarea rows="3" cols="80" name="dealmethod"></textarea>
						</TD>
					</TR>
					<TR>
						<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
							align=right> 
							处方记录
						</TD>
						<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
							colSpan=2 align=left>
							<textarea rows="3" cols="80" name="reciperecode"></textarea>
						</TD>
					</TR>
					<TR>
						<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
							align=right>
							记录医生
						</TD>
						<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
							colSpan=2 align=left>
							<INPUT class=jyts_bk2 size=15 type=text name="recdoctor" />
						</TD>
					</TR>
					<TR>
						<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
							align=center colspan="2">
							<input type="submit" value="保存" onclick="return mzCheck()">
						</TD>
					</TR>
				</TBODY>
				</TABLE>
				</form>
				</div>
				<div id="inhisbl">
						<form action="inhisdisease.do?method=addInHisDisease" method="post" name="inForm">
						<input class="jyts_bk2" size="10" type="hidden" name="inhisuid" id="inhiduid" value="${uidadd}"/>
						<TABLE border=0 cellSpacing=1 cellPadding=0 width=800 bgColor=#9bc8eb>
							<TBODY>
							<TR>
								<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
									align=right>
									入院时间
								</TD>
								<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
									colSpan=2 align=left>
									<input class="jyts_bk2" size="15" type="text" name="inhdate" readonly="readonly" onfocus="HS_setDate(this)"/>
								</TD>
							</TR>
							<TR>
								<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
									align=right>
									入院诊断
								</TD>
								<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
									colSpan=2 align=left>
									<input class="jyts_bk2" type="text" name="inhdiatnlose" size="15">
								</TD>
							</TR>
							<TR>
								<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
									align=right>
									出院时间
								</TD>
								<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
									colSpan=2 align=left>
									<input class="jyts_bk2" size="15" type="text" name="outhdate" readonly="readonly" onfocus="HS_setDate(this)"/>
								</TD>
							</TR>
							<TR>
								<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
									align=right>
									出院带药
								</TD>
								<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
									colSpan=2 align=left>
									<textarea rows="3" cols="80" name="ywlist"></textarea>请以这种格式书写（X,Y）逗号分隔
								</TD>
							</TR>
							<TR>
								<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
									align=center colspan="2">
									<center><input type="submit" value="保存" onclick="return inCheck()"></center>
								</TD>
							</TR>
							</TBODY>
						</TABLE>
						</form>
					
					</div>
					<div id="zybl">
						<form action="zydisease.do?method=addDis" method="post"  name="zyForm">
						<input class="jyts_bk2" size="10" type="hidden" name="zyuid" id="zyuid" value="${uidadd}"/>
						<TABLE border=0 cellSpacing=1 cellPadding=0 width=800 bgColor=#9bc8eb>
							<TBODY>
							<TR>
								<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
									align=right>
									主诉
								</TD>
								<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
									colSpan=2 align=left>
									<INPUT class=jyts_bk2 size=15 type=text  name="zyzs"/>
								</TD>
							</TR>
							<TR>
								<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
									align=right>
									时间
								</TD>
								<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
									colSpan=2 align=left>
									<INPUT class=jyts_bk2 size=15 type=text name="zytime" readonly="readonly" onfocus="HS_setDate(this)"/>
								</TD>
							</TR>
							<TR>
								<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
									align=right>
									病史
								</TD>
								<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
									colSpan=2 align=left>
									<textarea rows="3" name="zybs" cols="80"></textarea>
								</TD>
							</TR>
							<TR>
								<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
									align=right>
									诊断
								</TD>
								<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
									colSpan=2 align=left>
									<textarea rows="3"  name="zyzd" cols="80"></textarea>
								</TD>
							</TR>
							<TR>
								<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
									align=right>
									治疗方针
								</TD>
								<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
									colSpan=2 align=left>
									<textarea rows="3"  name="zycl" cols="80"></textarea>
								</TD>
							</TR>
							<TR>
								<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
									align=right>
									药方
								</TD>
								<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
									colSpan=2 align=left>
									<textarea rows="3"  name="zyyw" cols="80"></textarea>
								</TD>
							</TR>
							<TR>
						<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
							align=right>
							记录医生
						</TD>
						<TD class=jj_l_5 bgColor=#eefbfe height=33 vAlign=center width=341
							colSpan=2 align=left>
							<INPUT class=jyts_bk2 size=15 type=text  name="zydoctor" />
						</TD>
						</TR>
							<TR>
								<TD class=jj_r_5 bgColor=#eefbfe height=33 vAlign=center width=100
									align=center colspan="2">
									<center><input type="submit" value="保存" onclick="return zyCheck()"></center>
								</TD>
							</TR>
							</TBODY>
						</TABLE>
						</form>
					
					</div>
		</center>
	</body>
</html>
